package luo.Controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import luo.Service.UserService;
import luo.entity.User;
import luo.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author:let_free
 * @Date:2024/10/3/14:31
 **/
@RestController
@RequestMapping("/login")
@Api(tags = "登录接口")
public class LoginController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public AjaxResult login(@RequestBody User user) {
        String username = user.getUserName();
        String password = user.getPassword();
        return AjaxResult.success(null, userService.login(username, password));
    }
}
